<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			window.onload=function(){
			
				var btn1=document.getElementById("btn1");
				var u1=document.getElementById("u1");
				btn1.onclick=function(){
					var li=document.createElement("li");
					li.innerHTML="<a href='javascript:;' class='link'>新添加的超链接</a>";
					u1.appendChild(li);
				}
			/*事件的委派（利用事件的冒泡实现）*/	
				u1.onclick=function(event){
					event=event||window.event;
					if(event.target.className=="link"){
						alert("这是ul的单击响应函数");
					}
					
				}
			}
		</script>
	</head>
	<body>
		<button id="btn1">添加超链接</button>
		<ul id="u1">
			<li><a href="javascript:;" class="link">超链接1</a></li>
			<li><a href="javascript:;" class="link">超链接2</a></li>
			<li><a href="javascript:;" class="link">超链接3</a></li>
			
		</ul>
	</body>
</html>
